<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<html>
<head>
<title>_保修单打印</title>
<script type="text/javascript">

  $(function() {
		$("#queryForm").validate(); 
		$("#_fromDate").datepicker({ format:'yyyy-mm-dd'});
		$("#_toDate").datepicker({ format:'yyyy-mm-dd'});
		var now = new Date();
		var tomorrow = new Date();
		tomorrow.setDate(now.getDate()+1);
		if(!$("#_fromDate").val()){
			$("#_fromDate").val(now.Format("yyyy-MM-dd"));
		}
		if($("#_toDate").val() == ''){
			$("#_toDate").val(tomorrow.Format("yyyy-MM-dd"));
		}
  });
  var datatable_content;
		function initTable(){
			datatable_content = $("#contentTable").dataTable({
			  "bServerSide":true,
	           "sAjaxSource":'${ctx}/v2/workGuaranteeTask/page',
	           "fnServerData": callback,
	           "fnRowCallback":rowCallBack,
	           "bFilter": false,
	           "bSort": false,
	           "sZeroRecords": "查询无记录！",
	           "bProcessing": true, 
	           "oLanguage": {
	               "sUrl": '${ctx}/static/v2/js/plugins/datatables/cn.txt'
	            },
	             "aoColumns":[
	             	 {"mData": null},
	             	 {"mData": "batchCode"},
	             	 {"mData": "taskCode"},
	             	 {"mData": "shopna"},
	             	 {"mData": "shopCode"},
	             	 {"mData": "customerCode"},
	             	 {"mData": "warehouseCode"},
	             	 {"mData": "createTime"},
	             	 {"mData": "guaranteeStatus"},
	             	 {"mData": "id"},
	             ],
	             
	             "aoColumnDefs":[
	          	   {"aTargets": [8],
		              "mRender": function (data, display, row) {
		                   return data == 0 ? "未打印" :
	             				  data == 1 ? "已打印" : "";
			           }
		            },
	             
	             	{"aTargets": [9],
		              "mRender": function (data, display, row) {
		                    var rs = "";
		                    if(row.guaranteeStatus == 0){
		                   		 rs= "<a href=\"#printGuarantee\" role=\"button\" data-toggle=\"modal\" class=\"btn btn-primary\"  onclick=\"changeStatus('"+row.id+"','"+row.taskCode+"','"+row.shopCode+"','"+row.type+"')\">打印保修单</a>";
		                    }else{
		                    	 rs= "<a href=\"${ctx}/v2/workGuaranteeTask/v2_toReprintPage/"+row.taskCode+"/"+row.batchCode+"\" class=\"btn btn-primary\">重新打印保修单</a>";
		                    }
						    return rs;
			           }
		            },
	             ]
			});
			}
		
		var filterParam = {};
		function callback( sSource, aoData, fnCallback ) {
		 var formParam = $("#queryForm").serializeArray();
			for(var n in filterParam){
				formParam.push(filterParam[n]);
			}
		   $.ajax({ 
		       "type": "post",
		       "contentType": "application/json", 
		       "url": sSource,    
		       "dataType": "json",   
		       "data": JSON.stringify(aoData.concat(formParam)),
		       "success": fnCallback  
		   });   
		}
		/**
		*创建了行的回调
		*nRow为当前的tr
		*/
		function rowCallBack(nRow, aData, iDisplayIndex, iDisplayIndexFull){
			var iDisplayStart = datatable_content.fnSettings()._iDisplayStart;
			$("td:eq(0)", nRow).html(iDisplayStart+iDisplayIndex+1);
		}
		function query(){
			if($("#queryForm").valid()){
				if (datatable_content) {
					datatable_content.fnDestroy();
				}
				initTable();
			}
		}
		  //级联店铺
  function ajaxShop(item) {
        $("#_shopCode").html('');
		customerCode=item.value;
		if(customerCode==''){
		  return false;
		}
		$.ajax({
				type : 'post',
				url : '${ctx}/v2/workGuaranteeTask/ajaxShopsource',
				data : 'customerCode=' + customerCode,
				dataType : 'json',
				success : function(data) {
				  var tempString="";
				  tempString+="<option value=''></option>";
					if (data.status == "1") {
						$.each(data.content,function(i){
						    tempString+="<option value="+data.content[i].shopCode+">"+data.content[i].shopName;
						});
					} else {
						jAlert(data.content,"温馨提示");
					}
	                  $("#_shopCode").html(tempString);
	                  $("#_shopCode").trigger("chosen:updated");
	                 
				},
				error : function() {
					jAlert("获取信息错误！","温馨提示");
				}
			});
	}
		
	
	function printAjaxGuarantee(){
		printName = $("#guaranteeStylePrint").val();
		showBg();
		$.ajax({
			type : 'post',
			url : '${ctx}/v2/workGuaranteeTask/ajaxPrintGuarantee',
			data : {
				shopCode:shopCode,
				taskCode:taskCode
			},
			dataType : 'json',
			success : function(data) {
			showBg();
				if (data.status == "1") {
					if(data.shopCode == "HD0004"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeYFH(v,printName);
						});
					}else if(data.shopCode == "HD0064"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeTTG(v,printName);
						});
					}else if(data.shopCode == "HD0081"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeMH(v,printName);
						});
					}else if(data.shopCode == "HD0013"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeJS(v,printName);
						});
					}else if(data.shopCode == "HD0041"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeHF(v,printName);
						});
					}else if(data.shopCode == "HD0007"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeCY(v,printName);
						});
					}else if(data.shopCode == "HD0056"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeQY(v,printName);
						});
					}else if(data.shopCode == "HD0055"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeXY(v,printName);
						});
					}else if(data.shopCode == "HD0066"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeTY(v,printName);
						});
					}else if(data.shopCode == "HD0043"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeBoYou(v,printName);
						});
					}else if(data.shopCode == "HD0084"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeSMei(v,printName);
						});
					}else if(data.shopCode == "HD0060"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeHYu(v,printName);
						});
					}else if(data.shopCode == "HD0093"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeYBH(v,printName);
						});
					}else if(data.shopCode == "HD0058"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeYKu(v,printName);
						});
					}
					updateGuanteeStatus(taskCode);
					} else {
						closeBg();
					}
				 }
		});
	}
	
		//打印快递单
	function printExpress(printerName,content,width,height,rankno,expressNo,ordeno,companyCode) {
		LODOP.PRINT_INIT(taskName);
		LODOP.SET_PRINT_PAGESIZE(1,width,height,""); 
		//LODOP.ADD_PRINT_TEXT(10,10,200,60,rankno);
		//LODOP.ADD_PRINT_BARCODE(10, 200, 180, 40, "128B", expressNo);//打印出快递运单条码，测试后删除。
		eval(content);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			var item=LODOP.PRINT(); 
			if(item){
				ajaxPrintExpressOrdeno(ordeno,expressNo,companyCode);
			}
		}
	}
	function updateGuanteeStatus(taskCode){
		$.ajax({
			type : 'post',
			url : '${ctx}/v2/workGuaranteeTask/updateGuarantee',
			data : {
				taskCode:taskCode
			},
			dataType : 'json',
			success : function(data){
			if (data.status == "1") {
					 closeBg();
				} else {
					alert(data.content);
				}
			},
			error : function() {
					closeBg();
			}
		});
	}
	//盈丰行
	function printGuaranteeYFH(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2400,1399,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(60,'120mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(90,'120mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(120,'120mm',140,40,"商业");
		LODOP.ADD_PRINT_TEXT(120,'50mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(200+height,'50mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(200+height,'120mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(200+height,'140mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(200+height,'160mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(200+height,'180mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		LODOP.ADD_PRINT_TEXT(390,'150mm',40,40,count);
		LODOP.ADD_PRINT_TEXT(440,'50mm',40,40,"梁欣");
		LODOP.ADD_PRINT_TEXT(440,'100mm',40,40,"梁欣");
		LODOP.ADD_PRINT_TEXT(440,'120mm',250,100,"佛山市顺德区盈丰行网络科技有限公司");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//美的壹佰汇
	function printGuaranteeYBH(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2400,1399,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(60,'120mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(90,'120mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(120,'120mm',140,40,"商业");
		LODOP.ADD_PRINT_TEXT(120,'50mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(200+height,'50mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(200+height,'120mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(200+height,'140mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(200+height,'160mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(200+height,'180mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		LODOP.ADD_PRINT_TEXT(390,'150mm',40,40,count);
		LODOP.ADD_PRINT_TEXT(440,'50mm',40,40,"谢骑");
		LODOP.ADD_PRINT_TEXT(440,'100mm',40,40,"谢骑");
		LODOP.ADD_PRINT_TEXT(440,'120mm',250,100,"美的壹佰汇电子商务有限公司");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//天天购
	function printGuaranteeTTG(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2000,1015,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(30,'90mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(30,'140mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(60,'25mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(60,'140mm',140,40,MathRand());
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(100+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(100+height,'70mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(100+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(100+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(100+height,'140mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(230,'30mm',140,800,numToCny);
		LODOP.ADD_PRINT_TEXT(230,'120mm',140,800,"合计");
		LODOP.ADD_PRINT_TEXT(230,'140mm',140,800,count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//明辉
	function printGuaranteeMH(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1015,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(30,'20mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(50,'20mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(70,'20mm',140,40,MathRand());
		LODOP.ADD_PRINT_TEXT(100,'20mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(130+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(130+height,'70mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(130+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(130+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(130+height,'150mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		LODOP.ADD_PRINT_TEXT(240,'30mm',250,800,"美的全国服务热线:4008899315");
		LODOP.ADD_PRINT_TEXT(270,'30mm',300,800,"亲,如需退换货时，请将此保修单一并寄回，非常感谢亲的配合！");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//恒飞
	function printGuaranteeHF(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2100,1400,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(10,'30mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(30,'30mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(50,'30mm',140,40,MathRand());
		LODOP.ADD_PRINT_TEXT(100,'35mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		var count = 0;
		var ediorder = workOrder.order;
		var order = workOrder.order.orderItems;
		LODOP.ADD_PRINT_TEXT(120,'30mm',140,40,"顾客名称:"+ediorder.recena);
		LODOP.ADD_PRINT_TEXT(140,'30mm',140,40,"品名规格");
		LODOP.ADD_PRINT_TEXT(140,'90mm',140,40,"单位");
		LODOP.ADD_PRINT_TEXT(140,'120mm',140,40,"数量");
		LODOP.ADD_PRINT_TEXT(140,'150mm',140,40,"单价");
		LODOP.ADD_PRINT_TEXT(140,'180mm',140,40,"金额");
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(140+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(140+height,'90mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(140+height,'120mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(140+height,'150mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(140+height,'180mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(350,'30mm',300,800,"合计金额(大写):"+numToCny);
		LODOP.ADD_PRINT_TEXT(370,'30mm',300,800,"备注:"+ediorder.remark);
		LODOP.ADD_PRINT_TEXT(390,'30mm',300,800,"开票人:谢艳兰");
		LODOP.ADD_PRINT_TEXT(350,'160mm',140,800,"合计(小写):"+count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//金森
	function printGuaranteeJS(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1016,""); 
		var height=0;
		var ediorder = workOrder.order;
		LODOP.ADD_PRINT_TEXT(40,'40mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(60,'40mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(80,'40mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(80,'80mm',140,40,ediorder.recena);
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(100+height,'40mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(100+height,'100mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(100+height,'120mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(100+height,'140mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(100+height,'160mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(270,'30mm',140,80,numToCny);
		LODOP.ADD_PRINT_TEXT(270,'160mm',140,80,count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//楚鹰
	function printGuaranteeCY(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2000,1100,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(60,'150mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(90,'150mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(120,'30mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		LODOP.ADD_PRINT_TEXT(120,'150mm',140,40,MathRand());
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(170+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(170+height,'70mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(170+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(170+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(170+height,'150mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(330,'30mm',140,800,numToCny);
		LODOP.ADD_PRINT_TEXT(330,'120mm',140,800,"合计");
		LODOP.ADD_PRINT_TEXT(330,'150mm',140,800,count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//桥一
	function printGuaranteeQY(workOrder,printName){
		var ediorder = workOrder.order;
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1020,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(30,'20mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(50,'20mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(100,'40mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(100,'120mm',140,40,"电器");
		LODOP.ADD_PRINT_TEXT(120,'30mm',140,40,"顾客名称:"+ediorder.recena);
		LODOP.ADD_PRINT_TEXT(140,'30mm',140,40,"商品名称");
		LODOP.ADD_PRINT_TEXT(140,'85mm',140,40,"单位");
		LODOP.ADD_PRINT_TEXT(140,'105mm',140,40,"数量");
		LODOP.ADD_PRINT_TEXT(140,'125mm',140,40,"单价");
		LODOP.ADD_PRINT_TEXT(140,'145mm',140,40,"金额");
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(140+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(140+height,'85mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(140+height,'105mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(140+height,'125mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(140+height,'145mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(250,'30mm',250,800,"合计金额大写:"+numToCny);
		LODOP.ADD_PRINT_TEXT(250,'120mm',250,800,"合计金额小写:￥"+count);
		LODOP.ADD_PRINT_TEXT(310,'100mm',300,800,"陈秋");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//上海心羽
	function printGuaranteeXY(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1940,1016,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(10,'25mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(30,'25mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(70,'35mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(85,'52mm',140,40,"个人");
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(120+height,'25mm',180,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(120+height,'80mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(120+height,'120mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(120+height,'145mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(272,'85mm',140,800,numToCny);
		LODOP.ADD_PRINT_TEXT(272,'145mm',140,800,count);
		LODOP.ADD_PRINT_TEXT(300,'130mm',200,800,"上海农商银行黄渡支行");
		LODOP.ADD_PRINT_TEXT(325,'105mm',140,800,"洪佳妮");
		LODOP.ADD_PRINT_TEXT(325,'145mm',140,800,"宋燕");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//上海泰域
	function printGuaranteeTY(workOrder,printName){
		var ediorder = workOrder.order;
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1015,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(10,'20mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(30,'20mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(60,'25mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(100,'40mm',140,40,ediorder.recena);
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(120+height,'20mm',250,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(120+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(120+height,'130mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(220,'50mm',250,140,numToCny);
		LODOP.ADD_PRINT_TEXT(220,'120mm',300,140,count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//博佑
	function printGuaranteeBoYou(workOrder,printName){
		var ediorder = workOrder.order;
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2100,1410,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(25,'40mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(55,'40mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(100,'40mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(100,'100mm',140,40,"商业");
		LODOP.ADD_PRINT_TEXT(140,'30mm',140,40,"项目");
		LODOP.ADD_PRINT_TEXT(140,'80mm',140,40,"单位");
		LODOP.ADD_PRINT_TEXT(140,'100mm',140,40,"数量");
		LODOP.ADD_PRINT_TEXT(140,'120mm',140,40,"单价");
		LODOP.ADD_PRINT_TEXT(140,'140mm',140,40,"金额");
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(140+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(140+height,'80mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(140+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(140+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(140+height,'140mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(330,'30mm',250,800,"合计金额大写:"+numToCny);
		LODOP.ADD_PRINT_TEXT(330,'120mm',250,800,"合计金额小写:￥"+count);
		LODOP.ADD_PRINT_TEXT(370,'30mm',300,800,"开票人：王艳明");
		LODOP.ADD_PRINT_TEXT(370,'50mm',300,800,"收款人：王艳明");
		LODOP.ADD_PRINT_TEXT(370,'80mm',300,800,"开票单位（盖章）：佛山市博佑贸易有限公司");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//长沙生美
	function printGuaranteeSMei(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2100,1400,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(40,'30mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(60,'30mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(110,'40mm',80,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		var count = 0;
		var ediorder = workOrder.order;
		var order = workOrder.order.orderItems;
		LODOP.ADD_PRINT_TEXT(110,'90mm',140,40,ediorder.recena);
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(180+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(180+height,'90mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(180+height,'120mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(180+height,'150mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(180+height,'180mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(380,'50mm',300,800,numToCny);
		LODOP.ADD_PRINT_TEXT(380,'170mm',140,800,count);
		LODOP.ADD_PRINT_TEXT(410,'40mm',240,800,"长沙生美电子商务有限公司");
		LODOP.ADD_PRINT_TEXT(410,'170mm',140,800,"韩伦");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//浩宇博海
	function printGuaranteeHYu(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1015,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(40,'30mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(60,'30mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(80,'30mm',80,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		var count = 0;
		var ediorder = workOrder.order;
		var order = workOrder.order.orderItems;
		LODOP.ADD_PRINT_TEXT(80,'90mm',140,40,ediorder.recena);
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(130+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(130+height,'70mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(130+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(130+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(130+height,'150mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(270,'50mm',300,800,numToCny);
		LODOP.ADD_PRINT_TEXT(290,'130mm',140,800,"李辉");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
			//易酷
	function printGuaranteeYKu(workOrder,printName){
		var ediorder = workOrder.order;
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2100,1400,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(40,'20mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(50,'20mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(80,'20mm',80,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(80,'90mm',80,40,"商业");
		LODOP.ADD_PRINT_TEXT(110,'20mm',140,40,"顾客名称:"+ediorder.recena);
		LODOP.ADD_PRINT_TEXT(130,'20mm',140,40,"项目:");
		LODOP.ADD_PRINT_TEXT(130,'60mm',140,40,"单位:");
		LODOP.ADD_PRINT_TEXT(130,'90mm',140,40,"数量:");
		LODOP.ADD_PRINT_TEXT(130,'110mm',140,40,"单价:");
		LODOP.ADD_PRINT_TEXT(130,'130mm',140,40,"金额:");
		var count = 0;
		var ediorder = workOrder.order;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(130+height,'20mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(130+height,'60mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(130+height,'90mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(130+height,'110mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(130+height,'130mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(300,'30mm',300,800,"合计金额大写(人民币):"+numToCny);
		LODOP.ADD_PRINT_TEXT(300,'110mm',140,800,"合计金额小写:￥"+count);
		LODOP.ADD_PRINT_TEXT(350,'30mm',140,800,"开票人：蔡文洁");
		LODOP.ADD_PRINT_TEXT(350,'70mm',140,800,"收款人：");
		LODOP.ADD_PRINT_TEXT(350,'100mm',300,800,"开票单位（盖章）广东易酷电子商务有限公司");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
   function MathRand()
    {
    var Num="";
    for(var i=0;i<6;i++)
    {
    Num+=Math.floor(Math.random()*10);
    }
    return Num;
    }
    
    
	</script>

</head>

<body>
<div id="fullbg"></div>
<div id="dialog">
	<div>
		<img src="${ctx }/static/022.gif"></img>
	</div>
</div>
<section class="content">
<div class="row">
		<div class="col-md-12">

			<!-- Primary box -->
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-edit"></i>
					<h3 class="box-title">条件查询</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">
    <form class="form-search" id="queryForm" method="post" action="${ctx}/print/queryPrintList" >
    
    <div class="form-group row">
			<div class="col-sm-4">
				<div class="input-group col-sm-12">
					<span class="input-group-text"> 商家名称： </span> 
					<select class="form-control" id="_customerCode" name="search_EQ_customerCode" onchange="ajaxShop(this)">
						<option value=""></option>
						<c:forEach items="${customerList}" var="customer">
							<option value="${customer.customerCode}"
								<c:if test="${param.search_EQ_customerCode eq customer.customerCode}">selected=selected</c:if>>${customer.customerName}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			
			
			<div class="col-sm-4">
				<div class="input-group col-sm-12">
					<span class="input-group-text"> 作业仓库： </span> 
					<select class="form-control required" id="_warehouseCode" name="search_EQ_warehouseCode">
						<option value=""></option>
						<c:forEach items="${warehouseList}" var="wm">
							<option value="${wm.groupCode}"
							<c:if test="${param._warehouseCode eq wm.groupCode}">selected=selected</c:if>>${wm.groupName}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			
			<div class="col-sm-4">
				<div class="input-group col-sm-12">
					<span class="input-group-text">是否打印： </span> 
					<select class="form-control" id="_guaranteeStatus" name="search_EQ_guaranteeStatus">
						<option value="" >全选</option>
			        <option value="1" >已打印</option>
			        <option value="0" selected="selected">未打印</option>
					</select>
				</div>
			</div>
			
		</div>
		
		
		<div class="form-group row">
			
			<div class="col-sm-3">
				<div class="input-group col-sm-12">
					<span class="input-group-text">店铺： </span> 
					<select class="form-control" id="_shopCode" name="search_EQ_shopCode">
						<option value=""></option>
						<c:forEach items="${shopList}" var="sp">
							<option value="${sp.shopCode}"
							<c:if test="${param._shopCode eq sp.shopCode}">selected=selected</c:if>>${sp.shopName}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="input-group col-sm-12">
					<span class="input-group-text"> 创建日期： </span>
						<div class="input-group">
							<div class="input-group-addon">
								<i class="fa fa-calendar"></i>
							</div>
							<input type="text" class="form-control pull-right required" id="_fromDate" name="search_GTE_createTime" value="${param.search_GTE_createTime}"/>
						</div>
				</div>
			</div>
			
			<div class="col-sm-4">
				<div class="input-group col-sm-12">
					<span class="input-group-text">至： </span>
						<div class="input-group">
							<div class="input-group-addon">
								<i class="fa fa-calendar"></i>
							</div>
							<input type="text" class="form-control pull-right required" id="_toDate" name="search_LT_createTime" value="${param.search_LT_createTime}"/>
						</div>
				</div>
			</div>
			<button class="btn btn-primary" type="button" onclick="query()">搜索</button>
		</div>	
		 
	</form>
	</div>
	</div>
	</div>
	</div>
	
	<div class="form-group row">
		<div class="col-md-12">
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-list"></i>
					<h3 class="box-title">查询结果</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr>
		        <th>序号</th>
		        <th>批次编号</th>
			    <th>任务编号</th>
			    <th>店铺名</th>
			    <th>店铺编码</th>
			    <th>商家编码</th>
			    <th>仓库编码</th>
			    <th>创建时间</th>
			    <th>打印状态</th>
			    <th>操作</th>
			</tr></thead>
		<tbody>
		</tbody>
	</table>
	</div>
	</div>
	</div>
	</div>
	
	
	<div class="modal  fade"tabindex="-1" role="dialog" aria-labelledby="myModalLabel"	aria-hidden="true" id="printGuarantee">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h3 id="myModalLabel">
		                                                        打印保修单信息
						</h3>
						<span id="messageLable"></span>
					</div>
					<div class="modal-body" style="overflow: auto;">
						<div class="form-group row">
							<div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text"> 选择打印机: </span> 
									<select id="guaranteeStylePrint" name="guaranteeStylePrint" class="form-control"  >
			
									</select>
								</div>
							</div>
						</div>
					</div>
					
					
		
		           <c:if test="${order ne null }">
		               <div class="modal-footer">
						<a class="btn btn-primary" data-dismiss="modal" aria-hidden="true" onclick="pageAjaxPrinter()"> 立即打印 </a>
						<a class="btn" data-dismiss="modal" aria-hidden="true"> 关闭 </a>
					  </div>
		           </c:if>
		           <c:if test="${order eq null }">
					<div class="modal-footer">
						<a class="btn btn-primary" data-dismiss="modal" aria-hidden="true" onclick="printAjaxGuarantee()"> 立即打印 </a>
						<a class="btn" data-dismiss="modal" aria-hidden="true"> 关闭 </a>
					</div>
				  </c:if>
		  	</div>
		  </div>
		</div>
	</section>
	
	<script type="text/javascript">
	var taskCode = '';
	var type = '';
	var shopCode='';
	var workId = '';
	function changeStatus(workId,task,shopCode,type){
		workId=workId;
		taskCode=task;
		shopCode=shopCode;
		type=type;
		packFormPrinter("guaranteeStylePrint");
	}
	</script>
</body>
</html>
